load("@npm//:defs.bzl", "npm_link_all_packages")
load(
    "//src/material:config.bzl",
    "MATERIAL_ENTRYPOINTS",
    "MATERIAL_TARGETS",
    "MATERIAL_TESTING_TARGETS",
)
load("//tools:defaults.bzl", "ng_package", "sass_library", "ts_project")

package(default_visibility = ["//visibility:public"])

npm_link_all_packages()

ts_project(
    name = "material",
    srcs = ["index.ts"],
)

filegroup(
    name = "overviews",
    srcs = ["//src/material/%s:overview" % name for name in MATERIAL_ENTRYPOINTS],
)

filegroup(
    name = "tokens",
    srcs = ["//src/material/%s:tokens" % name for name in MATERIAL_ENTRYPOINTS],
)

sass_library(
    name = "sass_lib",
    srcs = [
        "_index.scss",
    ],
    deps = [
        "//src/material/autocomplete:theme",
        "//src/material/badge:theme",
        "//src/material/bottom-sheet:theme",
        "//src/material/button:fab_theme",
        "//src/material/button:icon_button_theme",
        "//src/material/button:theme",
        "//src/material/button-toggle:theme",
        "//src/material/card:theme",
        "//src/material/checkbox:theme",
        "//src/material/chips:theme",
        "//src/material/core:core_sass",
        "//src/material/core:ripple_sass",
        "//src/material/core:ripple_sass_theme",
        "//src/material/core:theme_sass",
        "//src/material/core/color",
        "//src/material/core/density/private:all_density",
        "//src/material/core/focus-indicators",
        "//src/material/core/m2:m2_sass",
        "//src/material/core/option:theme",
        "//src/material/core/selection/pseudo-checkbox:_pseudo_checkbox_common",
        "//src/material/core/selection/pseudo-checkbox:sass_theme",
        "//src/material/core/style:_validation",
        "//src/material/core/style:elevation",
        "//src/material/core/style:private",
        "//src/material/core/style:sass_utils",
        "//src/material/core/style:variables",
        "//src/material/core/style:vendor_prefixes",
        "//src/material/core/theming",
        "//src/material/core/theming:_color_api_backwards_compatibility",
        "//src/material/core/theming:_definition",
        "//src/material/core/theming:_inspection",
        "//src/material/core/theming:_palettes",
        "//src/material/core/theming:core_all_theme",
        "//src/material/core/tokens:m3_system",
        "//src/material/core/typography",
        "//src/material/core/typography:all_typography",
        "//src/material/core/typography:utils",
        "//src/material/datepicker:theme",
        "//src/material/dialog:dialog_legacy_padding",
        "//src/material/dialog:theme",
        "//src/material/divider:theme",
        "//src/material/expansion:theme",
        "//src/material/form-field:theme",
        "//src/material/grid-list:theme",
        "//src/material/icon:theme",
        "//src/material/input:theme",
        "//src/material/list:theme",
        "//src/material/menu:theme",
        "//src/material/paginator:theme",
        "//src/material/progress-bar:theme",
        "//src/material/progress-spinner:theme",
        "//src/material/radio:theme",
        "//src/material/select:theme",
        "//src/material/sidenav:theme",
        "//src/material/slide-toggle:theme",
        "//src/material/slider:theme",
        "//src/material/snack-bar:theme",
        "//src/material/sort:theme",
        "//src/material/stepper:theme",
        "//src/material/table:theme",
        "//src/material/tabs:theme",
        "//src/material/timepicker:theme",
        "//src/material/toolbar:theme",
        "//src/material/tooltip:theme",
        "//src/material/tree:theme",
    ],
)

# Creates the @angular/material package published to npm.
ng_package(
    name = "npm_package",
    package_name = "@angular/material",
    srcs = [
        "package.json",
        ":sass_lib",
        "//src/material/autocomplete:theme",
        "//src/material/badge:theme",
        "//src/material/bottom-sheet:theme",
        "//src/material/button:fab_theme",
        "//src/material/button:icon_button_theme",
        "//src/material/button:theme",
        "//src/material/button-toggle:theme",
        "//src/material/card:theme",
        "//src/material/checkbox:theme",
        "//src/material/chips:theme",
        "//src/material/core:core_sass",
        "//src/material/core:ripple_sass",
        "//src/material/core:ripple_sass_theme",
        "//src/material/core:theme_sass",
        "//src/material/core/color",
        "//src/material/core/density/private:all_density",
        "//src/material/core/focus-indicators",
        "//src/material/core/m2:m2_sass",
        "//src/material/core/option:theme",
        "//src/material/core/selection/pseudo-checkbox:_pseudo_checkbox_common",
        "//src/material/core/selection/pseudo-checkbox:sass_theme",
        "//src/material/core/style:_validation",
        "//src/material/core/style:elevation",
        "//src/material/core/style:private",
        "//src/material/core/style:sass_utils",
        "//src/material/core/style:variables",
        "//src/material/core/style:vendor_prefixes",
        "//src/material/core/theming",
        "//src/material/core/theming:_color_api_backwards_compatibility",
        "//src/material/core/theming:_definition",
        "//src/material/core/theming:_inspection",
        "//src/material/core/theming:_palettes",
        "//src/material/core/theming:core_all_theme",
        "//src/material/core/tokens:m3_system",
        "//src/material/core/typography",
        "//src/material/core/typography:all_typography",
        "//src/material/core/typography:utils",
        "//src/material/datepicker:theme",
        "//src/material/dialog:dialog_legacy_padding",
        "//src/material/dialog:theme",
        "//src/material/divider:theme",
        "//src/material/expansion:theme",
        "//src/material/form-field:theme",
        "//src/material/grid-list:theme",
        "//src/material/icon:theme",
        "//src/material/input:theme",
        "//src/material/list:theme",
        "//src/material/menu:theme",
        "//src/material/paginator:theme",
        "//src/material/prebuilt-themes:azure-blue",
        "//src/material/prebuilt-themes:cyan-orange",
        "//src/material/prebuilt-themes:deeppurple-amber",
        "//src/material/prebuilt-themes:indigo-pink",
        "//src/material/prebuilt-themes:magenta-violet",
        "//src/material/prebuilt-themes:pink-bluegrey",
        "//src/material/prebuilt-themes:purple-green",
        "//src/material/prebuilt-themes:rose-red",
        "//src/material/progress-bar:theme",
        "//src/material/progress-spinner:theme",
        "//src/material/radio:theme",
        "//src/material/select:theme",
        "//src/material/sidenav:theme",
        "//src/material/slide-toggle:theme",
        "//src/material/slider:theme",
        "//src/material/snack-bar:theme",
        "//src/material/sort:theme",
        "//src/material/stepper:theme",
        "//src/material/table:theme",
        "//src/material/tabs:theme",
        "//src/material/timepicker:theme",
        "//src/material/toolbar:theme",
        "//src/material/tooltip:theme",
        "//src/material/tree:theme",
    ],
    nested_packages = ["//src/material/schematics:npm_package"],
    package_deps = [
        ":node_modules/@angular/cdk",
    ],
    tags = ["release-package"],
    visibility = [
        "//:__pkg__",
        "//goldens:__pkg__",
        "//integration:__subpackages__",
    ],
    deps = MATERIAL_TARGETS + MATERIAL_TESTING_TARGETS,
)
